package com.hsyt.pms.sys.dubbo.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.hsyt.pfc.support.rpc.PageResult;
import com.hsyt.pms.api.dto.system.SysUrlWhiteDto;
import com.hsyt.pms.api.vo.system.SysUrlWhiteVo;
import com.hsyt.pms.orm.sys.SysUrlWhiteDao;
import com.hsyt.pms.sys.dubbo.SysUserService;
import com.hsyt.pms.sys.dubbo.SysUrlWhiteService;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import com.alibaba.dubbo.config.annotation.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName: SysUrlWhiteServiceImpl
 * @Description: 白名单
 * @author wangze@hsyuntai.com
 * @date 2019年2月12日 下午2:45:51
 */
@Slf4j
@Component
@Service(version = "0.0.1", interfaceClass = SysUrlWhiteService.class, registry = "pms", group = "pmsSystem", timeout = 3000)
public class SysUrlWhiteServiceImpl implements SysUrlWhiteService {

    private static final Logger LOGGER = LoggerFactory.getLogger(SysUrlWhiteServiceImpl.class);

    @Resource
    private SysUrlWhiteDao sysUrlWhiteDao;

    @Override
    public Boolean insertSelective(SysUrlWhiteDto record) {
        return sysUrlWhiteDao.insertSelective(record) == 1;
    }

    @Override
    public Boolean updateByPrimaryKeySelective(SysUrlWhiteDto record) {
        return sysUrlWhiteDao.updateByPrimaryKeySelective(record) == 1;
    }

    @Override
    public int findPageDataCountByDto(SysUrlWhiteDto dto) {
        return sysUrlWhiteDao.findPageDataCountByDto(dto);
    }

    @Override
    public PageResult<SysUrlWhiteVo> searchPageDataByDto(SysUrlWhiteDto dto) {
        Page<?> page = PageHelper.startPage(dto.getPageNumber(), dto.getPageSize(), true);
        List<SysUrlWhiteVo> list = sysUrlWhiteDao.queryUrlWhiteByDto(dto);
        PageResult<SysUrlWhiteVo> pageResult = PageResult.create(page.getTotal(), list);
        return pageResult;
    }

}
